#include "config.h"

// 第1层最大池化
void lenet_mp1(
    dtype din[C1_OUT_CH][C1_OUT_SIZE][C1_OUT_SIZE],
    dtype dout[C1_OUT_CH][C1_OUT_SIZE/2][C1_OUT_SIZE/2]
){
    for (int index_ch = 0; index_ch < C1_OUT_CH; index_ch++){
        for (int i = 0; i < C1_OUT_SIZE/2; i++){
            for (int j = 0; j < C1_OUT_SIZE/2; j++){
                dout[index_ch][i][j] = MAX(
                    MAX(din[index_ch][(i<<1)][(j<<1)],
                        din[index_ch][(i<<1)][(j<<1) + 1]),
                    MAX(din[index_ch][(i<<1) + 1][(j<<1)],
                        din[index_ch][(i<<1) + 1][(j<<1) + 1]));
            }
        }
    }
}
